package de.klingbeil.hhc.client.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

import de.klingbeil.hhc.client.event.ItemChangedEvent.ItemChangedHandler;
import de.klingbeil.hhc.client.model.ItemModelData;

public class ItemChangedEvent extends GwtEvent<ItemChangedHandler> {

	public static final Type<ItemChangedHandler> TYPE = new Type<ItemChangedHandler>();
	private final ItemModelData item;

	public interface ItemChangedHandler extends EventHandler {
		void onItemChanged(ItemChangedEvent itemChangedEvent);
	}

	public ItemChangedEvent(ItemModelData item) {
		this.item = item;
	}

	public ItemModelData getItem() {
		return item;
	}

	@Override
	public Type<ItemChangedHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(ItemChangedHandler handler) {
		handler.onItemChanged(this);
	}

}
